import { GENDER } from '@/enum/user';
import { ApiProperty } from '@nestjs/swagger';
import { IsMobilePhone, IsNotEmpty } from 'class-validator';

export class PhoneLoginDto {
  @ApiProperty({ description: '用户openid', example: 'openId' })
  openId?: string;

  @ApiProperty({
    description: '用户昵称',
    example: '开玩笑',
  })
  nickName: string;

  @ApiProperty({
    description: '用户性别',
    example: GENDER.UNKNONW,
    default: GENDER.UNKNONW,
  })
  gender: GENDER;

  @ApiProperty({
    description: '用户头像',
    example: '开玩笑',
  })
  avatarUrl: string;

  @ApiProperty({
    description: '用户所在国家',
    example: '中国',
  })
  country?: string;

  @ApiProperty({
    description: '用户所在省份',
    example: '福建省',
  })
  province?: string;

  @ApiProperty({
    description: '用户所在城市',
    example: '南平市',
  })
  city?: string;

  @ApiProperty({
    description: '用户使用语言',
    example: '中文',
  })
  language?: string;

  @ApiProperty({
    description: '用户手机号',
    example: '189508xdasjdhn',
  })
  @IsMobilePhone('zh-CN', {}, { message: '手机号码格式错误' })
  phone: string;

  @ApiProperty({
    description: '验证码',
  })
  @IsNotEmpty({
    message: '验证码不能为空',
  })
  code: string;

  @ApiProperty({
    description: '验证码携带的token',
  })
  @IsNotEmpty({
    message: '验证码携带的token',
  })
  token: string;
}
